Skip to content

feat(api): add missing client protocol operations for views, permissions, workflows, realtime, notifications, AI, i18n#547

Merged
hotlong merged 3 commits intomainfrom
copilot/improve-api-specifications
Feb 8, 2026
Merged

feat(api): add missing client protocol operations for views, permissions, workflows, realtime, notifications, AI, i18n#547
hotlong merged 3 commits intomainfrom
copilot/improve-api-specifications

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 8, 2026

The @objectstack/client SDK surface audit identified 7 missing namespaces with no corresponding protocol definitions in protocol.zod.ts. This adds the 33 missing Request/Response schema pairs, protocol methods, type exports, and legacy interface bindings.

New protocol namespaces

  • Views (5 ops) — listViews, getView, createView, updateView, deleteView
  • Permissions (3 ops) — checkPermission, getObjectPermissions, getEffectivePermissions
  • Workflows (5 ops) — getWorkflowConfig, getWorkflowState, workflowTransition, workflowApprove, workflowReject with WorkflowStateSchema for state machine representation
  • Realtime (6 ops) — realtimeConnect, realtimeDisconnect, realtimeSubscribe, realtimeUnsubscribe, setPresence, getPresence
  • Notifications (7 ops) — device registration, preference management, listing with cursor pagination, mark read/all read
  • AI (4 ops) — aiNlq, aiChat, aiSuggest, aiInsights
  • i18n (3 ops) — getLocales, getTranslations, getFieldLabels

Design decisions

  • Imports existing domain schemas where available (ObjectPermissionSchema, WorkflowRuleSchema, RealtimePresenceSchema, TranslationDataSchema, ViewSchema) rather than duplicating definitions
  • WorkflowStateSchema is new — models current state, available transitions, and transition history for the approval engine
  • NotificationPreferencesSchema supports per-channel overrides with digest frequency
  • All schemas follow existing conventions: .describe() on every field, z.input<> for request types, z.infer<> for response types

Example usage

import type {
  CheckPermissionRequest,
  WorkflowTransitionRequest,
  AiNlqRequest,
} from '@objectstack/spec/api';

// Permission check
const req: CheckPermissionRequest = {
  object: 'account',
  action: 'edit',
  recordId: 'acc_123',
};

// Workflow transition
const transition: WorkflowTransitionRequest = {
  object: 'deal',
  recordId: 'd_001',
  transition: 'submit_for_approval',
  comment: 'Ready for review',
};

ObjectStackProtocolSchema grows from 28 → 61 methods. Tests added for all 7 namespaces (3081 total, all passing).


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-studio Error Error Feb 8, 2026 7:47am
spec Ready Ready Preview, Comment Feb 8, 2026 7:47am

Request Review

…rkflows, realtime, notifications, AI, and i18n

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…ows, Realtime, Notifications, AI, i18n)

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Update API protocols and functionality for SDK feat(api): add missing client protocol operations for views, permissions, workflows, realtime, notifications, AI, i18n Feb 8, 2026
Copilot AI requested a review from hotlong February 8, 2026 07:48
@hotlong hotlong marked this pull request as ready for review February 8, 2026 08:13
Copilot AI review requested due to automatic review settings February 8, 2026 08:13
@hotlong hotlong merged commit 3e41aa7 into main Feb 8, 2026
6 of 7 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the missing client-facing protocol namespaces to @objectstack/spec so the SDK can rely on first-class Request/Response schemas (and generated JSON Schemas) for Views, Permissions, Workflows, Realtime, Notifications, AI, and i18n.

Changes:

  • Added new Request/Response Zod schemas + type exports + legacy interface bindings for 7 previously-missing namespaces.
  • Extended ObjectStackProtocolSchema with 33 new protocol methods corresponding to those operations.
  • Regenerated/updated JSON Schema outputs (QA schema descriptions + new API operation schemas; removed obsolete integration JSON schemas).

Reviewed changes

Copilot reviewed 80 out of 80 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/spec/src/api/protocol.zod.ts Adds new Zod request/response schemas, protocol methods, and exported TS types for the missing namespaces.
packages/spec/src/api/protocol.test.ts Adds validation tests for a subset of the new protocol schemas.
packages/spec/json-schema/qa/TestSuite.json Adds missing description fields in generated QA JSON schema.
packages/spec/json-schema/qa/TestStep.json Adds missing description fields in generated QA JSON schema.
packages/spec/json-schema/qa/TestScenario.json Adds missing description fields in generated QA JSON schema.
packages/spec/json-schema/qa/TestAssertionType.json Adds missing description fields in generated QA JSON schema.
packages/spec/json-schema/qa/TestAssertion.json Adds missing description fields in generated QA JSON schema.
packages/spec/json-schema/qa/TestActionType.json Adds missing description fields in generated QA JSON schema.
packages/spec/json-schema/qa/TestAction.json Adds missing description fields in generated QA JSON schema.
packages/spec/json-schema/integration/FieldTransform.json Removes obsolete generated integration JSON schema.
packages/spec/json-schema/integration/Authentication.json Removes obsolete generated integration JSON schema.
packages/spec/json-schema/api/WorkflowTransitionResponse.json New generated JSON schema for WorkflowTransitionResponse.
packages/spec/json-schema/api/WorkflowTransitionRequest.json New generated JSON schema for WorkflowTransitionRequest.
packages/spec/json-schema/api/WorkflowState.json New generated JSON schema for WorkflowState.
packages/spec/json-schema/api/WorkflowRejectResponse.json New generated JSON schema for WorkflowRejectResponse.
packages/spec/json-schema/api/WorkflowRejectRequest.json New generated JSON schema for WorkflowRejectRequest.
packages/spec/json-schema/api/WorkflowApproveResponse.json New generated JSON schema for WorkflowApproveResponse.
packages/spec/json-schema/api/WorkflowApproveRequest.json New generated JSON schema for WorkflowApproveRequest.
packages/spec/json-schema/api/UpdateNotificationPreferencesResponse.json New generated JSON schema for UpdateNotificationPreferencesResponse.
packages/spec/json-schema/api/UpdateNotificationPreferencesRequest.json New generated JSON schema for UpdateNotificationPreferencesRequest.
packages/spec/json-schema/api/UnregisterDeviceResponse.json New generated JSON schema for UnregisterDeviceResponse.
packages/spec/json-schema/api/UnregisterDeviceRequest.json New generated JSON schema for UnregisterDeviceRequest.
packages/spec/json-schema/api/SetPresenceResponse.json New generated JSON schema for SetPresenceResponse.
packages/spec/json-schema/api/SetPresenceRequest.json New generated JSON schema for SetPresenceRequest.
packages/spec/json-schema/api/RegisterDeviceResponse.json New generated JSON schema for RegisterDeviceResponse.
packages/spec/json-schema/api/RegisterDeviceRequest.json New generated JSON schema for RegisterDeviceRequest.
packages/spec/json-schema/api/RealtimeUnsubscribeResponse.json New generated JSON schema for RealtimeUnsubscribeResponse.
packages/spec/json-schema/api/RealtimeUnsubscribeRequest.json New generated JSON schema for RealtimeUnsubscribeRequest.
packages/spec/json-schema/api/RealtimeSubscribeResponse.json New generated JSON schema for RealtimeSubscribeResponse.
packages/spec/json-schema/api/RealtimeSubscribeRequest.json New generated JSON schema for RealtimeSubscribeRequest.
packages/spec/json-schema/api/RealtimeDisconnectResponse.json New generated JSON schema for RealtimeDisconnectResponse.
packages/spec/json-schema/api/RealtimeDisconnectRequest.json New generated JSON schema for RealtimeDisconnectRequest.
packages/spec/json-schema/api/RealtimeConnectResponse.json New generated JSON schema for RealtimeConnectResponse.
packages/spec/json-schema/api/RealtimeConnectRequest.json New generated JSON schema for RealtimeConnectRequest.
packages/spec/json-schema/api/NotificationPreferences.json New generated JSON schema for NotificationPreferences.
packages/spec/json-schema/api/Notification.json New generated JSON schema for Notification.
packages/spec/json-schema/api/MarkNotificationsReadResponse.json New generated JSON schema for MarkNotificationsReadResponse.
packages/spec/json-schema/api/MarkNotificationsReadRequest.json New generated JSON schema for MarkNotificationsReadRequest.
packages/spec/json-schema/api/MarkAllNotificationsReadResponse.json New generated JSON schema for MarkAllNotificationsReadResponse.
packages/spec/json-schema/api/MarkAllNotificationsReadRequest.json New generated JSON schema for MarkAllNotificationsReadRequest.
packages/spec/json-schema/api/ListViewsRequest.json New generated JSON schema for ListViewsRequest.
packages/spec/json-schema/api/ListNotificationsResponse.json New generated JSON schema for ListNotificationsResponse.
packages/spec/json-schema/api/ListNotificationsRequest.json New generated JSON schema for ListNotificationsRequest.
packages/spec/json-schema/api/GetWorkflowStateResponse.json New generated JSON schema for GetWorkflowStateResponse.
packages/spec/json-schema/api/GetWorkflowStateRequest.json New generated JSON schema for GetWorkflowStateRequest.
packages/spec/json-schema/api/GetWorkflowConfigResponse.json New generated JSON schema for GetWorkflowConfigResponse.
packages/spec/json-schema/api/GetWorkflowConfigRequest.json New generated JSON schema for GetWorkflowConfigRequest.
packages/spec/json-schema/api/GetViewResponse.json New generated JSON schema for GetViewResponse.
packages/spec/json-schema/api/GetViewRequest.json New generated JSON schema for GetViewRequest.
packages/spec/json-schema/api/GetTranslationsResponse.json New generated JSON schema for GetTranslationsResponse.
packages/spec/json-schema/api/GetTranslationsRequest.json New generated JSON schema for GetTranslationsRequest.
packages/spec/json-schema/api/GetPresenceResponse.json New generated JSON schema for GetPresenceResponse.
packages/spec/json-schema/api/GetPresenceRequest.json New generated JSON schema for GetPresenceRequest.
packages/spec/json-schema/api/GetObjectPermissionsResponse.json New generated JSON schema for GetObjectPermissionsResponse.
packages/spec/json-schema/api/GetObjectPermissionsRequest.json New generated JSON schema for GetObjectPermissionsRequest.
packages/spec/json-schema/api/GetNotificationPreferencesResponse.json New generated JSON schema for GetNotificationPreferencesResponse.
packages/spec/json-schema/api/GetNotificationPreferencesRequest.json New generated JSON schema for GetNotificationPreferencesRequest.
packages/spec/json-schema/api/GetLocalesResponse.json New generated JSON schema for GetLocalesResponse.
packages/spec/json-schema/api/GetLocalesRequest.json New generated JSON schema for GetLocalesRequest.
packages/spec/json-schema/api/GetFieldLabelsResponse.json New generated JSON schema for GetFieldLabelsResponse.
packages/spec/json-schema/api/GetFieldLabelsRequest.json New generated JSON schema for GetFieldLabelsRequest.
packages/spec/json-schema/api/GetEffectivePermissionsResponse.json New generated JSON schema for GetEffectivePermissionsResponse.
packages/spec/json-schema/api/GetEffectivePermissionsRequest.json New generated JSON schema for GetEffectivePermissionsRequest.
packages/spec/json-schema/api/DeleteViewResponse.json New generated JSON schema for DeleteViewResponse.
packages/spec/json-schema/api/DeleteViewRequest.json New generated JSON schema for DeleteViewRequest.
packages/spec/json-schema/api/CreateViewRequest.json New generated JSON schema for CreateViewRequest.
packages/spec/json-schema/api/CheckPermissionResponse.json New generated JSON schema for CheckPermissionResponse.
packages/spec/json-schema/api/CheckPermissionRequest.json New generated JSON schema for CheckPermissionRequest.
packages/spec/json-schema/api/AiSuggestResponse.json New generated JSON schema for AiSuggestResponse.
packages/spec/json-schema/api/AiSuggestRequest.json New generated JSON schema for AiSuggestRequest.
packages/spec/json-schema/api/AiNlqResponse.json New generated JSON schema for AiNlqResponse.
packages/spec/json-schema/api/AiNlqRequest.json New generated JSON schema for AiNlqRequest.
packages/spec/json-schema/api/AiInsightsResponse.json New generated JSON schema for AiInsightsResponse.
packages/spec/json-schema/api/AiInsightsRequest.json New generated JSON schema for AiInsightsRequest.
packages/spec/json-schema/api/AiChatResponse.json New generated JSON schema for AiChatResponse.
packages/spec/json-schema/api/AiChatRequest.json New generated JSON schema for AiChatRequest.

Comment on lines +971 to +975
// View Management Operations
listViews: z.function()
.describe('List views for an object'),
getView: z.function()
.describe('Get a specific view'),
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjectStackProtocolSchema declares new protocol methods as z.function() with only .describe(). Without .args(...) and .returns(...), the contract doesn’t actually bind these operations to the Request/Response schemas (and inferred types degrade to unknown), which undermines the stated goal of SDK/protocol generation. Define each new method with its corresponding request schema and promise-wrapped response schema (and ideally retrofit the existing methods in this object similarly for consistency). Reference pattern: packages/spec/src/data/data-engine.zod.ts (e.g. DataEngineContractSchema.find).

Copilot uses AI. Check for mistakes.
Comment on lines +170 to +188
it('validates Views operations', () => {
expect(ListViewsRequestSchema.safeParse({ object: 'project', type: 'list' }).success).toBe(true);
expect(ListViewsResponseSchema.safeParse({
object: 'project',
views: [{ list: { columns: [] } }],
}).success).toBe(true);
expect(GetViewRequestSchema.safeParse({ object: 'project', viewId: 'v1' }).success).toBe(true);
expect(CreateViewRequestSchema.safeParse({
object: 'project',
data: { list: { columns: [] } },
}).success).toBe(true);
expect(UpdateViewRequestSchema.safeParse({
object: 'project',
viewId: 'v1',
data: { list: { columns: [] } },
}).success).toBe(true);
expect(DeleteViewRequestSchema.safeParse({ object: 'project', viewId: 'v1' }).success).toBe(true);
expect(DeleteViewResponseSchema.safeParse({ object: 'project', viewId: 'v1', success: true }).success).toBe(true);
});
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new protocol surface adds many Request/Response schemas, but protocol.test.ts only validates a subset. Several newly introduced schemas appear to have no test coverage anywhere in packages/spec/src (e.g. RealtimeDisconnectRequestSchema, MarkAllNotificationsReadRequestSchema, GetViewResponseSchema, UpdateViewResponseSchema). Add safeParse tests for the remaining new operations/schemas so regressions in schema shape/defaults are caught.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants